<#escape x as x?html>
<div class="cover-fusion bg-default">
    <div class="row">
        <div class="col-md-6 col-lg-4">
            <img class="carousel-inner img-responsive img-rounded"
                 src="/assets/img/system_manager_bg.png">
        </div>
        <div class="col-md-6 col-lg-8">
            <div class="row cover-interval-small"></div>
            <h2 class="cover-title">系统管理</h2>
            <div class="line-solid"></div>
            <h4 class="cover-content">
                对用户、角色进行管理。对审计日志进行查看。
            </h4>
            <button class="btn btn-default btn-md action-init-dv-mapping">
                <i class="fa fa-refresh">初始化虚拟数据库映射</i>
            </button>
            <button class="btn btn-default btn-md action-init-search-index">
                <i class="fa fa-refresh">初始化元数据检索</i>
            </button>
        </div>
    </div>
    <div class="row cover-interval"></div>
    <div class="row cover-section">
        <div class="col-md-6">
            <h3><img src="/assets/img/system_manager_user.png">用户管理</h3>
            <p>
                对用户进行增删改查操作。
            </p>
        </div>
        <div class="col-md-6">
            <h3><img src="/assets/img/system_manager_role.png">角色管理</h3>
            <p>
                对角色进行增删改查操作，关联菜单权限。
            </p>
        </div>
    </div>
    <div class="row cover-section">
        <div class="col-md-6">
            <h3><img src="/assets/img/system_manager_audit_log.png">审计日志</h3>
            <p>
                查看用户对平台的相关操作。比如登录。
            </p>
        </div>
    </div>
</div>
<script>
    context.call([
        "jQuery",
        "tools",
        "bootstrap-dialog"
    ], function (jQuery, tools, dialog) {
//        tools.modalSave({message:'1111',callback:function (result,dialogRef) {
//            alert(result);
//            alert(dialogRef.getModalBody().html());
//        }});
        $(".action-init-dv-mapping").on("click", function () {
            tools.confirmWaring({
                title: '初始化虚拟数据库映射',
                message: '是否进行初始化？',
                callback: function (result) {
                    if (result) {
                        $.ajax({
                            async: false,
                            url: "/init/dv-mapping",
                            dataType: "json",
                            success: function (msg) {
                                if (msg.code == 200) {
                                    tools.message({message: "初始化虚拟数据库映射成功。", title: "初始化结果"});
                                } else {
                                    tools.message({message: "初始化虚拟数据库映射失败。<br/>" + msg.info, title: "初始化结果"});
                                }
                            },
                            error: function (msg) {
                                tools.message({message: "初始化虚拟数据库映射失败。<br/>" + msg.info, title: "初始化结果"});
                            }
                        });
                    }
                },
                callbackContent: "后台正在初始化虚拟数据库映射中。"
            });
        });
        $(".action-init-search-index").on("click", function () {
            tools.confirmWaring({
                title: '初始化元数据检索',
                message: '是否进行初始化？',
                callback: function (result) {
                    if (result) {
                        $.ajax({
                            async: false,
                            url: "/init/search-index",
                            dataType: "json",
                            success: function (msg) {
                                if (msg.code == 200) {
                                    tools.message({message: "初始化元数据检索成功。", title: "初始化结果"});
                                } else {
                                    tools.message({message: "初始化元数据检索失败。<br/>" + msg.info, title: "初始化结果"});
                                }
                            },
                            error: function (msg) {
                                tools.info({message: "初始化元数据检索失败。<br/>" + msg.info, title: "初始化结果"});
                            }
                        });
                    }
                },
                callbackContent: "后台正在初始化元数据检索中。"
            });
        });
    })
</script>
</#escape>